using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Grebok.Common;
using Grebok.Common.Configuration;

namespace EVegetable.Persistence.Test.DataManager
{
    public class BaseManager
    {
        protected ApplicationProperties appPropertiese;
        protected IDictionary<string, object> appPropertieseValues;

        #region Utility Methods

        protected T GetConfig<T>(string key)
        {
            if (!appPropertieseValues.ContainsKey(key))
            {
                appPropertieseValues.Add(key, appPropertiese[key]);
            }

            return ConvertUtil.FromType<T, string>(appPropertieseValues[key].ToString());
        }

        protected void SetConfig<T>(string key, T value)
        {
            appPropertiese[key] = ConvertUtil.FromType<string, T>(value);
            appPropertieseValues[key] = appPropertiese[key];
        }

        #endregion
    }
}
